<ui:composition xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:f="http://java.sun.com/jsf/core"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:p="http://primefaces.org/ui"
	xmlns:form="http://java.sun.com/jsf/composite/components/form"
	xmlns:sec="http://www.springframework.org/security/tags"
	template="/templates/include/securedmain.xhtml">

	<ui:define name="content">

		<h:form id="form">
			<p:growl id="growl" showDetail="true" sticky="false" />
			<p:panelGrid id="grid" columns="2" rowClasses="center-td">
				<f:facet name="header">
					<h:outputText value="#{msg['view.objectview.form.head']}" />
				</f:facet>
				<h:outputText value="#{msg['properties.object.name']}:" />
				<h:outputText value="#{viewObjectBean.selectedItem.name}" id="name" />

				<h:outputText value="#{msg['properties.object.identifier']}:" />
				<h:outputText binding="#{ident}"
					value="#{viewObjectBean.selectedItem.identifier}" id="ident" />

				<h:outputText value="#{msg['properties.object.description']}:" />
				<h:outputText autoResize="false"
					value="#{viewObjectBean.selectedItem.description}" id="desc" />

				<h:outputText value="#{msg['properties.objectclass.name']}:" />
				<h:link outcome="viewobjectclass"
					value="#{viewObjectBean.selectedItem.objectClass.name}">
					<f:param name="id" value="#{viewObjectBean.selectedItem.objectClass.id}" />
				</h:link>

				<h:outputLabel for="pickupState"
					value="#{msg['properties.period.state.pickup']}:" />
				<h:outputText id="pickupState" value="#{viewObjectBean.pickStatus}" />
				<h:outputLabel for="returnItBackState"
					value="#{msg['properties.period.state.returnitback']}:" />
				<h:outputText id="returnItBackState"
					value="#{viewObjectBean.returnStatus}" />

				<f:facet name="footer">
					<sec:authorize ifAnyGranted="ROLE_ADMIN, ROLE_MASTER">
						<p:button id="viewCalendarButton"
							value="#{msg['view.actions.calendar']}" icon="ui-icon-calendar"
							update="@form" ajax="false" outcome="/secured/objectcalendar">
							<f:param name="id" value="#{viewObjectBean.selectedItem.id}" />
						</p:button>
					</sec:authorize>
					<sec:authorize ifAnyGranted="ROLE_USER">
						<p:button id="viewCalendarButton"
							value="#{msg['view.actions.calendar']}" icon="ui-icon-calendar"
							update="@form" ajax="false" outcome="/secured/objectusercalendar">
							<f:param name="id" value="#{viewObjectBean.selectedItem.id}" />
						</p:button>
					</sec:authorize>

					<p:commandButton id="favouriteMeButton" icon="ui-icon-star"
						rendered="#{!favouriteBean.favourite}"
						value="#{msg['view.actions.favourite']}"
						actionListener="#{favouriteBean.favourite}" update="@form"
						ajax="false">
						<f:param name="id" value="#{viewObjectBean.id}" />
					</p:commandButton>

					<p:commandButton id="unfavouriteMeButton" icon="ui-icon-cancel"
						rendered="#{favouriteBean.favourite}"
						value="#{msg['view.actions.unfavourite']}"
						actionListener="#{favouriteBean.unfavourite}" update="@form"
						ajax="false">
						<f:param name="id" value="#{viewObjectBean.id}" />
					</p:commandButton>
				</f:facet>
			</p:panelGrid>
		</h:form>
	</ui:define>
</ui:composition>
